// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import store from './store/store'
import Qs from 'qs'
import {getUrlKey} from './common/utils'

import './common/toast/toast.css';
import Toast from './common/toast/index';
Vue.use(Toast);

Vue.prototype.$axios = axios;

window.axios = axios;
window.Qs = Qs;
Vue.config.productionTip = false;
Vue.config.devtools = true;

//获取鉴权
global.key = getUrlKey('authorization');
axios.defaults.headers.common['authorization'] = 'Bearer '+ global.key;

let baseUrl = process.env.NODE_ENV == 'development' ? 'http://dev.renduoduow.com' : 'http://api.renduoduow.com';
// let baseUrl = process.env.NODE_ENV == 'development' ? 'http://dev.renduoduow.com' : 'http://dev.renduoduow.com';
axios.defaults.baseURL = baseUrl;
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
  store,
  render: h => h(App)
})
